import{_ as O}from"./moreEdit.vue_vue_type_style_index_0_lang.js";import S from"./dropWrap.js";import{d as R,e as d,r as c,o as V,n as w,a as p,P as g,Q as C,$ as o,X as s,a4 as b,R as m,a5 as H,ab as N,ac as j,S as A,K as E}from"./elementPlusModules.js";import"./index90.js";import"./index.js";import"./vxeTableModules.js";import"./lodashModules.js";import"./index91.js";import"./useDateFormat.js";const B={style:{height:"100%"}},P={style:{height:"400px",display:"flex","flex-direction":"column"}},$={class:"language-js"},G=R({__name:"showTable",setup(I){let y=d(`
    引入组件
            import basicTableSum from "@/components/MerakEditTable/components/basicTable/moreEdit.vue";
            
            <div style="height: 400px;display: flex; flex-direction: column;">
                    <basicTableSum v-bind="tableConfig" @editFormFun="editFormClick" ref="editTableRef">
                        <template #title_zh="{scope}"> 
                            <el-select filterable v-model="scope.title_zh.value" @change="value=>changeSelect(value,scope)">
                                <el-option v-for="selectItem in options" :key="selectItem.value" :label="selectItem.label"
                                    :value="selectItem.value" />
                            </el-select>
                        </template>
                        <template #handle="{ row }">
                            //操作列
                            <el-button type="danger" link @click="delFun(row)">删除</el-button>

                        </template>
                    </basicTableSum>
                </div>
        //默认支持可编辑类型 // input  date select
        //editFormFun  编辑之后事件返回当前编辑行

        1）const tableConfig = reactive({
                headData: tableHeadData,//表格头部数据   必须值
                tableData: tableData,//表格内容数据      必须值
                headConfig: headConfig,//可编辑列类型    必须值 
              
           })


            tableHeadData=[{
                title: "属性值(中文)",
                field: 'title_zh',
                length:'10'
                }]
            headConfig={
                title_zh: "input",
                title_ru:{
                    type:"select", 
                    options:options
                }
            }
            tableData=[{
                title_zh: {
                label: "",
                value: ""
            }}]


            //获取提交表单数据
            const editTableRef=ref(null)
            editTableRef.value.submitData(params);//参数可传可不传
  `);const _=d(null),x=(e,t)=>{let l=h.find(r=>r.value==e);t.title_zh.label=l.label,t.title_zh.value=e;let i=JSON.parse(JSON.stringify(a.value[t.index]));i.title_zh=t.title_zh,a.value.splice(t.index,1,i),console.log(a.value)},z=()=>{let e={title_zh:{label:"",value:""},title_ru:{label:"",value:""},bieming:{label:"",value:""},sort:{label:"",value:""}};a.value.push(e)},k=e=>{let t=e.index;a.value.splice(t,1)},T=e=>{let t=e.index;a.value.splice(t,1,e)},D=()=>{let e=["bieming","sort","title_ru","title_zh"],t=a.value.map(l=>(e.map(i=>{var r;(r=l[i])==null||delete r.errTip,l[i].value||(l[i].errTip="为必填项！！！")}),{...l}));a.value=t,console.log(_.value.submitData())},h=[{value:"1",label:"Option1"},{value:"2",label:"Option2"},{value:"3",label:"Option3"},{value:"4",label:"Option4"},{value:"5",label:"Option5"}],v=c([]),a=d([]),f=c({}),F=c({headData:v,tableData:a,headConfig:f,selection:!1,dragDrop:!0,number:!0});return V(()=>{w(()=>{Prism.highlightAll()}),Object.assign(v,[{title:"属性值(中文)",field:"title_zh",length:"10"}]),Object.assign(f,{title_zh:"input",title_ru:"input",bieming:"input",sort:"input"});let l=[{title_zh:{label:"",value:""},title_ru:{label:"",value:""},bieming:{label:"",value:""},sort:{label:"",value:""}}];a.value=l}),(e,t)=>{const l=p("el-button"),i=p("el-option"),r=p("el-select");return g(),C("div",B,[o(l,{type:"primary",onClick:z},{default:s(()=>[b("新增")]),_:1}),o(l,{type:"primary",onClick:D},{default:s(()=>[b("确定")]),_:1}),m("div",P,[o(O,j({ref_key:"editTableRef",ref:_},F,{onEditFormFun:T}),{title_zh:s(({scope:u})=>[o(r,{filterable:"",modelValue:u.title_zh.value,"onUpdate:modelValue":n=>u.title_zh.value=n,onChange:n=>x(n,u)},{default:s(()=>[(g(),C(H,null,N(h,n=>o(i,{key:n.value,label:n.label,value:n.value},null,8,["label","value"])),64))]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])]),handle:s(({row:u})=>[o(l,{type:"danger",link:"",onClick:n=>k(u)},{default:s(()=>[b("删除")]),_:2},1032,["onClick"])]),_:1},16)]),o(S,{key:"oreo"},{default:s(()=>[m("pre",null,[m("code",$,A(E(y))+" ",1)])]),_:1})])}}});export{G as default};
